<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>LCOV - ged.info - gil/image_view_factory.hpp</title>
  <link rel="stylesheet" type="text/css" href="../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LTP GCOV extension - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
        <tr>
          <td class="headerItem" width="20%">Current&nbsp;view:</td>
          <td class="headerValue" width="80%" colspan=4><a href="../index.html">directory</a> - <a href="index.html">gil</a> - image_view_factory.hpp</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Test:</td>
          <td class="headerValue" width="80%" colspan=4>ged.info</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Date:</td>
          <td class="headerValue" width="20%">2009-06-09</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Instrumented&nbsp;lines:</td>
          <td class="headerValue" width="20%">13</td>
        </tr>
        <tr>
          <td class="headerItem" width="20%">Code&nbsp;covered:</td>
          <td class="headerValue" width="20%">100.0 %</td>
          <td width="20%"></td>
          <td class="headerItem" width="20%">Executed&nbsp;lines:</td>
          <td class="headerValue" width="20%">13</td>
        </tr>
        </table>
      </td>
    </tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td><pre class="source">
<span class="lineNum">       1 </span>                : /*
<span class="lineNum">       2 </span>                :     Copyright 2005-2007 Adobe Systems Incorporated
<span class="lineNum">       3 </span>                :    
<span class="lineNum">       4 </span>                :     Use, modification and distribution are subject to the Boost Software License,
<span class="lineNum">       5 </span>                :     Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
<span class="lineNum">       6 </span>                :     http://www.boost.org/LICENSE_1_0.txt).
<span class="lineNum">       7 </span>                : 
<span class="lineNum">       8 </span>                :     See http://opensource.adobe.com/gil for most recent version including documentation.
<span class="lineNum">       9 </span>                : */
<span class="lineNum">      10 </span>                : 
<span class="lineNum">      11 </span>                : /*************************************************************************************************/
<span class="lineNum">      12 </span>                : 
<span class="lineNum">      13 </span>                : #ifndef GIL_IMAGE_VIEW_FACTORY_HPP
<span class="lineNum">      14 </span>                : #define GIL_IMAGE_VIEW_FACTORY_HPP
<span class="lineNum">      15 </span>                : 
<span class="lineNum">      16 </span>                : /*!
<span class="lineNum">      17 </span>                : /// \file               
<span class="lineNum">      18 </span>                : /// \brief Methods for constructing image views from raw data or other image views
<span class="lineNum">      19 </span>                : /// \author Lubomir Bourdev and Hailin Jin \n
<span class="lineNum">      20 </span>                : ///         Adobe Systems Incorporated
<span class="lineNum">      21 </span>                : /// \date   2005-2007 \n Last updated on March 9, 2007
<span class="lineNum">      22 </span>                : /// Methods for creating shallow image views from raw pixel data or from other image views - 
<span class="lineNum">      23 </span>                : /// flipping horizontally or vertically, axis-aligned rotation, a subimage, subsampled 
<span class="lineNum">      24 </span>                : /// or n-th channel image view. Derived image views are shallow copies and are fast to construct.
<span class="lineNum">      25 </span>                : */
<span class="lineNum">      26 </span>                : 
<span class="lineNum">      27 </span>                : #include &lt;cassert&gt;
<span class="lineNum">      28 </span>                : #include &lt;cstddef&gt;
<span class="lineNum">      29 </span>                : #include &quot;gil_config.hpp&quot;
<span class="lineNum">      30 </span>                : #include &quot;metafunctions.hpp&quot;
<span class="lineNum">      31 </span>                : #include &quot;gray.hpp&quot;
<span class="lineNum">      32 </span>                : #include &quot;color_convert.hpp&quot;
<span class="lineNum">      33 </span>                : 
<span class="lineNum">      34 </span>                : /// \defgroup ImageViewConstructors Image View From Raw Data
<span class="lineNum">      35 </span>                : /// \ingroup ImageViewAlgorithm
<span class="lineNum">      36 </span>                : /// \brief Methods for constructing image views from raw data and for getting raw data from views
<span class="lineNum">      37 </span>                : 
<span class="lineNum">      38 </span>                : /// \defgroup ImageViewTransformations Image View Transformations
<span class="lineNum">      39 </span>                : /// \ingroup ImageViewAlgorithm
<span class="lineNum">      40 </span>                : /// \brief Methods for constructing one image view from another
<span class="lineNum">      41 </span>                : 
<span class="lineNum">      42 </span>                : namespace boost { namespace gil {
<span class="lineNum">      43 </span>                : struct default_color_converter;
<span class="lineNum">      44 </span>                : 
<span class="lineNum">      45 </span>                : template &lt;typename T&gt; struct dynamic_x_step_type;
<span class="lineNum">      46 </span>                : template &lt;typename T&gt; struct dynamic_y_step_type;
<span class="lineNum">      47 </span>                : template &lt;typename T&gt; struct transposed_type;
<span class="lineNum">      48 </span>                : 
<span class="lineNum">      49 </span>                : /// \brief Returns the type of a view that has a dynamic step along both X and Y
<span class="lineNum">      50 </span>                : /// \ingroup ImageViewTransformations
<span class="lineNum">      51 </span>                : template &lt;typename View&gt; 
<span class="lineNum">      52 </span>                : struct dynamic_xy_step_type : public dynamic_y_step_type&lt;typename dynamic_x_step_type&lt;View&gt;::type&gt; {};
<span class="lineNum">      53 </span>                : 
<span class="lineNum">      54 </span>                : /// \brief Returns the type of a transposed view that has a dynamic step along both X and Y
<span class="lineNum">      55 </span>                : /// \ingroup ImageViewTransformations
<span class="lineNum">      56 </span>                : template &lt;typename View&gt; 
<span class="lineNum">      57 </span>                : struct dynamic_xy_step_transposed_type : public dynamic_xy_step_type&lt;typename transposed_type&lt;View&gt;::type&gt; {};
<span class="lineNum">      58 </span>                : 
<span class="lineNum">      59 </span>                : 
<span class="lineNum">      60 </span>                : /// \ingroup ImageViewConstructors
<span class="lineNum">      61 </span>                : /// \brief Constructing image views from raw interleaved pixel data
<span class="lineNum">      62 </span>                : template &lt;typename Iterator&gt;
<span class="lineNum">      63 </span>                : typename type_from_x_iterator&lt;Iterator&gt;::view_t
<span class="lineNum">      64 </span>                : interleaved_view(std::size_t width, std::size_t height,
<span class="lineNum">      65 </span>                :                  Iterator pixels, std::ptrdiff_t rowsize_in_bytes) {
<span class="lineNum">      66 </span>                :     typedef typename type_from_x_iterator&lt;Iterator&gt;::view_t RView;
<span class="lineNum">      67 </span>                :     return RView(width, height, typename RView::locator(pixels, rowsize_in_bytes));
<span class="lineNum">      68 </span>                : }
<span class="lineNum">      69 </span>                : 
<span class="lineNum">      70 </span>                : /// \ingroup ImageViewConstructors
<span class="lineNum">      71 </span>                : /// \brief Constructing image views from raw interleaved pixel data
<span class="lineNum">      72 </span>                : template &lt;typename Iterator&gt;
<span class="lineNum">      73 </span>                : typename type_from_x_iterator&lt;Iterator&gt;::view_t
<span class="lineNum">      74 </span>                : interleaved_view(point2&lt;std::size_t&gt; dim,
<span class="lineNum">      75 </span>                :                  Iterator pixels, std::ptrdiff_t rowsize_in_bytes) {
<span class="lineNum">      76 </span>                :     typedef typename type_from_x_iterator&lt;Iterator&gt;::view_t RView;
<span class="lineNum">      77 </span>                :     return RView(dim, typename RView::locator(pixels, rowsize_in_bytes));
<span class="lineNum">      78 </span>                : }
<span class="lineNum">      79 </span>                : 
<span class="lineNum">      80 </span>                : /////////////////////////////
<span class="lineNum">      81 </span>                : //  interleaved_view_get_raw_data, planar_view_get_raw_data - return pointers to the raw data (the channels) of a basic homogeneous view.
<span class="lineNum">      82 </span>                : /////////////////////////////
<span class="lineNum">      83 </span>                : 
<span class="lineNum">      84 </span>                : namespace detail {
<span class="lineNum">      85 </span>                :     template &lt;typename View, bool IsMutable&gt; struct channel_pointer_type_impl;
<span class="lineNum">      86 </span>                : 
<span class="lineNum">      87 </span>                :     template &lt;typename View&gt; struct channel_pointer_type_impl&lt;View, true&gt; {
<span class="lineNum">      88 </span>                :         typedef       typename channel_type&lt;View&gt;::type* type;
<span class="lineNum">      89 </span>                :     };
<span class="lineNum">      90 </span>                :     template &lt;typename View&gt; struct channel_pointer_type_impl&lt;View, false&gt; {
<span class="lineNum">      91 </span>                :         typedef const typename channel_type&lt;View&gt;::type* type;
<span class="lineNum">      92 </span>                :     };
<span class="lineNum">      93 </span>                : 
<span class="lineNum">      94 </span>                :     template &lt;typename View&gt; struct channel_pointer_type
<span class="lineNum">      95 </span>                :         : public channel_pointer_type_impl&lt;View, view_is_mutable&lt;View&gt;::value&gt; {};
<span class="lineNum">      96 </span>                : } // namespace detail
<span class="lineNum">      97 </span>                : 
<span class="lineNum">      98 </span>                : /// \ingroup ImageViewConstructors
<span class="lineNum">      99 </span>                : /// \brief Returns C pointer to the the channels of an interleaved homogeneous view.
<span class="lineNum">     100 </span>                : template &lt;typename HomogeneousView&gt;
<span class="lineNum">     101 </span>                : typename detail::channel_pointer_type&lt;HomogeneousView&gt;::type interleaved_view_get_raw_data(const HomogeneousView&amp; view) {
<span class="lineNum">     102 </span>                :     BOOST_STATIC_ASSERT((!is_planar&lt;HomogeneousView&gt;::value &amp;&amp; view_is_basic&lt;HomogeneousView&gt;::value));
<span class="lineNum">     103 </span>                :     BOOST_STATIC_ASSERT((boost::is_pointer&lt;typename HomogeneousView::x_iterator&gt;::value));
<span class="lineNum">     104 </span>                : 
<span class="lineNum">     105 </span>                :     return &amp;at_c&lt;0&gt;(view(0,0));
<span class="lineNum">     106 </span>                : }
<span class="lineNum">     107 </span>                : 
<span class="lineNum">     108 </span>                : /// \ingroup ImageViewConstructors
<span class="lineNum">     109 </span>                : /// \brief Returns C pointer to the the channels of a given color plane of a planar homogeneous view.
<span class="lineNum">     110 </span>                : template &lt;typename HomogeneousView&gt;
<span class="lineNum">     111 </span>                : typename detail::channel_pointer_type&lt;HomogeneousView&gt;::type planar_view_get_raw_data(const HomogeneousView&amp; view, int plane_index) {
<span class="lineNum">     112 </span>                :     BOOST_STATIC_ASSERT((is_planar&lt;HomogeneousView&gt;::value &amp;&amp; view_is_basic&lt;HomogeneousView&gt;::value));
<span class="lineNum">     113 </span>                :     return dynamic_at_c(view.row_begin(0),plane_index);
<span class="lineNum">     114 </span>                : }
<span class="lineNum">     115 </span>                : 
<span class="lineNum">     116 </span>                : 
<span class="lineNum">     117 </span>                : /// \defgroup ImageViewTransformationsColorConvert color_converted_view
<span class="lineNum">     118 </span>                : /// \ingroup ImageViewTransformations
<span class="lineNum">     119 </span>                : /// \brief Color converted view of another view
<span class="lineNum">     120 </span>                : 
<span class="lineNum">     121 </span>                : /// \ingroup ImageViewTransformationsColorConvert PixelDereferenceAdaptorModel
<span class="lineNum">     122 </span>                : /// \brief Function object that given a source pixel, returns it converted to a given color space and channel depth. Models: PixelDereferenceAdaptorConcept
<span class="lineNum">     123 </span>                : ///
<span class="lineNum">     124 </span>                : /// Useful in constructing a color converted view over a given image view
<span class="lineNum">     125 </span>                : template &lt;typename SrcConstRefP, typename DstP, typename CC=default_color_converter &gt;        // const_reference to the source pixel and destination pixel value
<span class="lineNum">     126 </span>                : class color_convert_deref_fn : public deref_base&lt;color_convert_deref_fn&lt;SrcConstRefP,DstP,CC&gt;, DstP, DstP, const DstP&amp;, SrcConstRefP, DstP, false&gt; {
<span class="lineNum">     127 </span>                : private:
<span class="lineNum">     128 </span>                :     CC _cc;                     // color-converter
<span class="lineNum">     129 </span>                : public:
<span class="lineNum">     130 </span>                :     color_convert_deref_fn() {}
<span class="lineNum">     131 </span>                :     color_convert_deref_fn(CC cc_in) : _cc(cc_in) {}
<span class="lineNum">     132 </span>                : 
<span class="lineNum">     133 </span>                :     DstP operator()(SrcConstRefP srcP) const {
<span class="lineNum">     134 </span>                :         DstP dstP;
<span class="lineNum">     135 </span>                :         _cc(srcP,dstP);
<span class="lineNum">     136 </span>                :         return dstP;
<span class="lineNum">     137 </span>                :     }
<span class="lineNum">     138 </span>                : };
<span class="lineNum">     139 </span>                : 
<span class="lineNum">     140 </span>                : namespace detail {
<span class="lineNum">     141 </span>                :     // Add color converter upon dereferencing
<span class="lineNum">     142 </span>                :     template &lt;typename SrcView, typename CC, typename DstP, typename SrcP&gt;
<span class="lineNum">     143 </span>                :     struct _color_converted_view_type {
<span class="lineNum">     144 </span>                :     private:
<span class="lineNum">     145 </span>                :         typedef color_convert_deref_fn&lt;typename SrcView::const_t::reference,DstP,CC&gt; deref_t;
<span class="lineNum">     146 </span>                :         typedef typename SrcView::template add_deref&lt;deref_t&gt; add_ref_t;
<span class="lineNum">     147 </span>                :     public:
<span class="lineNum">     148 </span>                :         typedef typename add_ref_t::type type;
<span class="lineNum">     149 </span>                :         static type make(const SrcView&amp; sv,CC cc) {return add_ref_t::make(sv,deref_t(cc));}
<span class="lineNum">     150 </span>                :     };
<span class="lineNum">     151 </span>                : 
<span class="lineNum">     152 </span>                :     // If the Src view has the same pixel type as the target, there is no need for color conversion
<span class="lineNum">     153 </span>                :     template &lt;typename SrcView, typename CC, typename DstP&gt;
<span class="lineNum">     154 </span>                :     struct _color_converted_view_type&lt;SrcView,CC,DstP,DstP&gt; {
<span class="lineNum">     155 </span>                :         typedef SrcView type;
<span class="lineNum">     156 </span>                :         static type make(const SrcView&amp; sv,CC) {return sv;}
<span class="lineNum">     157 </span>                :     };
<span class="lineNum">     158 </span>                : } // namespace detail
<span class="lineNum">     159 </span>                : 
<span class="lineNum">     160 </span>                : 
<span class="lineNum">     161 </span>                : /// \brief Returns the type of a view that does color conversion upon dereferencing its pixels 
<span class="lineNum">     162 </span>                : /// \ingroup ImageViewTransformationsColorConvert
<span class="lineNum">     163 </span>                : template &lt;typename SrcView, typename DstP, typename CC=default_color_converter&gt;
<span class="lineNum">     164 </span>                : struct color_converted_view_type : public detail::_color_converted_view_type&lt;SrcView,
<span class="lineNum">     165 </span>                :                                                                              CC,
<span class="lineNum">     166 </span>                :                                                                              DstP,
<span class="lineNum">     167 </span>                :                                                                              typename SrcView::value_type&gt; {
<span class="lineNum">     168 </span>                :     GIL_CLASS_REQUIRE(DstP, boost::gil, MutablePixelConcept)//why does it have to be mutable???
<span class="lineNum">     169 </span>                : };
<span class="lineNum">     170 </span>                : 
<span class="lineNum">     171 </span>                : 
<span class="lineNum">     172 </span>                : /// \ingroup ImageViewTransformationsColorConvert
<span class="lineNum">     173 </span>                : /// \brief view of a different color space with a user defined color-converter
<span class="lineNum">     174 </span>                : template &lt;typename DstP, typename View, typename CC&gt;
<span class="lineNum">     175 </span>                : inline typename color_converted_view_type&lt;View,DstP,CC&gt;::type color_converted_view(const View&amp; src,CC cc) {
<span class="lineNum">     176 </span>                :     return color_converted_view_type&lt;View,DstP,CC&gt;::make(src,cc);
<span class="lineNum">     177 </span>                : }
<span class="lineNum">     178 </span>                : 
<span class="lineNum">     179 </span>                : /// \ingroup ImageViewTransformationsColorConvert
<span class="lineNum">     180 </span>                : /// \brief overload of generic color_converted_view with the default color-converter
<span class="lineNum">     181 </span>                : template &lt;typename DstP, typename View&gt;
<span class="lineNum">     182 </span>                : inline typename color_converted_view_type&lt;View,DstP&gt;::type
<span class="lineNum">     183 </span>                : color_converted_view(const View&amp; src) {
<span class="lineNum">     184 </span>                :     return color_converted_view&lt;DstP&gt;(src,default_color_converter());
<span class="lineNum">     185 </span>                : }
<span class="lineNum">     186 </span>                : 
<span class="lineNum">     187 </span>                : /// \defgroup ImageViewTransformationsFlipUD flipped_up_down_view
<span class="lineNum">     188 </span>                : /// \ingroup ImageViewTransformations
<span class="lineNum">     189 </span>                : /// \brief view of a view flipped up-to-down
<span class="lineNum">     190 </span>                : 
<span class="lineNum">     191 </span>                : /// \ingroup ImageViewTransformationsFlipUD
<span class="lineNum">     192 </span>                : template &lt;typename View&gt;
<span class="lineNum">     193 </span><span class="lineCov">              4 : inline typename dynamic_y_step_type&lt;View&gt;::type flipped_up_down_view(const View&amp; src) { </span>
<span class="lineNum">     194 </span>                :     typedef typename dynamic_y_step_type&lt;View&gt;::type RView;
<span class="lineNum">     195 </span><span class="lineCov">              4 :     return RView(src.dimensions(),typename RView::xy_locator(src.xy_at(0,src.height()-1),-1));</span>
<span class="lineNum">     196 </span>                : }
<span class="lineNum">     197 </span>                : 
<span class="lineNum">     198 </span>                : /// \defgroup ImageViewTransformationsFlipLR flipped_left_right_view
<span class="lineNum">     199 </span>                : /// \ingroup ImageViewTransformations
<span class="lineNum">     200 </span>                : /// \brief view of a view flipped left-to-right
<span class="lineNum">     201 </span>                : 
<span class="lineNum">     202 </span>                : /// \ingroup ImageViewTransformationsFlipLR
<span class="lineNum">     203 </span>                : template &lt;typename View&gt; 
<span class="lineNum">     204 </span><span class="lineCov">              4 : inline typename dynamic_x_step_type&lt;View&gt;::type flipped_left_right_view(const View&amp; src) {</span>
<span class="lineNum">     205 </span>                :     typedef typename dynamic_x_step_type&lt;View&gt;::type RView;
<span class="lineNum">     206 </span><span class="lineCov">              4 :     return RView(src.dimensions(),typename RView::xy_locator(src.xy_at(src.width()-1,0),-1,1));</span>
<span class="lineNum">     207 </span>                : }
<span class="lineNum">     208 </span>                : 
<span class="lineNum">     209 </span>                : /// \defgroup ImageViewTransformationsTransposed transposed_view
<span class="lineNum">     210 </span>                : /// \ingroup ImageViewTransformations
<span class="lineNum">     211 </span>                : /// \brief view of a view transposed
<span class="lineNum">     212 </span>                : 
<span class="lineNum">     213 </span>                : /// \ingroup ImageViewTransformationsTransposed
<span class="lineNum">     214 </span>                : template &lt;typename View&gt;
<span class="lineNum">     215 </span>                : inline typename dynamic_xy_step_transposed_type&lt;View&gt;::type transposed_view(const View&amp; src) {
<span class="lineNum">     216 </span>                :     typedef typename dynamic_xy_step_transposed_type&lt;View&gt;::type RView;
<span class="lineNum">     217 </span>                :     return RView(src.height(),src.width(),typename RView::xy_locator(src.xy_at(0,0),1,1,true));
<span class="lineNum">     218 </span>                : }
<span class="lineNum">     219 </span>                : 
<span class="lineNum">     220 </span>                : /// \defgroup ImageViewTransformations90CW rotated90cw_view
<span class="lineNum">     221 </span>                : /// \ingroup ImageViewTransformations
<span class="lineNum">     222 </span>                : /// \brief view of a view rotated 90 degrees clockwise
<span class="lineNum">     223 </span>                : 
<span class="lineNum">     224 </span>                : /// \ingroup ImageViewTransformations90CW
<span class="lineNum">     225 </span>                : template &lt;typename View&gt; 
<span class="lineNum">     226 </span><span class="lineCov">              5 : inline typename dynamic_xy_step_transposed_type&lt;View&gt;::type rotated90cw_view(const View&amp; src) {</span>
<span class="lineNum">     227 </span>                :     typedef typename dynamic_xy_step_transposed_type&lt;View&gt;::type RView;
<span class="lineNum">     228 </span><span class="lineCov">              5 :     return RView(src.height(),src.width(),typename RView::xy_locator(src.xy_at(0,src.height()-1),-1,1,true));</span>
<span class="lineNum">     229 </span>                : }
<span class="lineNum">     230 </span>                : 
<span class="lineNum">     231 </span>                : /// \defgroup ImageViewTransformations90CCW rotated90ccw_view
<span class="lineNum">     232 </span>                : /// \ingroup ImageViewTransformations
<span class="lineNum">     233 </span>                : /// \brief view of a view rotated 90 degrees counter-clockwise
<span class="lineNum">     234 </span>                : 
<span class="lineNum">     235 </span>                : /// \ingroup ImageViewTransformations90CCW
<span class="lineNum">     236 </span>                : template &lt;typename View&gt; 
<span class="lineNum">     237 </span><span class="lineCov">              4 : inline typename dynamic_xy_step_transposed_type&lt;View&gt;::type rotated90ccw_view(const View&amp; src) {</span>
<span class="lineNum">     238 </span>                :     typedef typename dynamic_xy_step_transposed_type&lt;View&gt;::type RView;
<span class="lineNum">     239 </span><span class="lineCov">              4 :     return RView(src.height(),src.width(),typename RView::xy_locator(src.xy_at(src.width()-1,0),1,-1,true));</span>
<span class="lineNum">     240 </span>                : }
<span class="lineNum">     241 </span>                : 
<span class="lineNum">     242 </span>                : /// \defgroup ImageViewTransformations180 rotated180_view
<span class="lineNum">     243 </span>                : /// \ingroup ImageViewTransformations
<span class="lineNum">     244 </span>                : /// \brief view of a view rotated 180 degrees
<span class="lineNum">     245 </span>                : 
<span class="lineNum">     246 </span>                : /// \ingroup ImageViewTransformations180
<span class="lineNum">     247 </span>                : template &lt;typename View&gt; 
<span class="lineNum">     248 </span>                : inline typename dynamic_xy_step_type&lt;View&gt;::type rotated180_view(const View&amp; src) {
<span class="lineNum">     249 </span>                :     typedef typename dynamic_xy_step_type&lt;View&gt;::type RView;
<span class="lineNum">     250 </span>                :     return RView(src.dimensions(),typename RView::xy_locator(src.xy_at(src.width()-1,src.height()-1),-1,-1));
<span class="lineNum">     251 </span>                : }
<span class="lineNum">     252 </span>                : 
<span class="lineNum">     253 </span>                : /// \defgroup ImageViewTransformationsSubimage subimage_view
<span class="lineNum">     254 </span>                : /// \ingroup ImageViewTransformations
<span class="lineNum">     255 </span>                : /// \brief view of an axis-aligned rectangular area within an image_view
<span class="lineNum">     256 </span>                : 
<span class="lineNum">     257 </span>                : /// \ingroup ImageViewTransformationsSubimage
<span class="lineNum">     258 </span>                : template &lt;typename View&gt; 
<span class="lineNum">     259 </span>                : inline View subimage_view(const View&amp; src, const typename View::point_t&amp; topleft, const typename View::point_t&amp; dimensions) {
<span class="lineNum">     260 </span>                :     return View(dimensions,src.xy_at(topleft));
<span class="lineNum">     261 </span>                : }
<span class="lineNum">     262 </span>                : 
<span class="lineNum">     263 </span>                : /// \ingroup ImageViewTransformationsSubimage
<span class="lineNum">     264 </span>                : template &lt;typename View&gt; 
<span class="lineNum">     265 </span><span class="lineCov">              3 : inline View subimage_view(const View&amp; src, int xMin, int yMin, int width, int height) {</span>
<span class="lineNum">     266 </span><span class="lineCov">              3 :     return View(width,height,src.xy_at(xMin,yMin));</span>
<span class="lineNum">     267 </span>                : }
<span class="lineNum">     268 </span>                : 
<span class="lineNum">     269 </span>                : /// \defgroup ImageViewTransformationsSubsampled subsampled_view
<span class="lineNum">     270 </span>                : /// \ingroup ImageViewTransformations
<span class="lineNum">     271 </span>                : /// \brief view of a subsampled version of an image_view, stepping over a number of channels in X and number of rows in Y
<span class="lineNum">     272 </span>                : 
<span class="lineNum">     273 </span>                : /// \ingroup ImageViewTransformationsSubsampled
<span class="lineNum">     274 </span>                : template &lt;typename View&gt; 
<span class="lineNum">     275 </span><span class="lineCov">              2 : inline typename dynamic_xy_step_type&lt;View&gt;::type subsampled_view(const View&amp; src, typename View::coord_t xStep, typename View::coord_t yStep) {</span>
<span class="lineNum">     276 </span><span class="lineCov">              2 :     assert(xStep&gt;0 &amp;&amp; yStep&gt;0);</span>
<span class="lineNum">     277 </span>                :     typedef typename dynamic_xy_step_type&lt;View&gt;::type RView;
<span class="lineNum">     278 </span>                :     return RView((src.width()+(xStep-1))/xStep,(src.height()+(yStep-1))/yStep,
<span class="lineNum">     279 </span><span class="lineCov">              2 :                                           typename RView::xy_locator(src.xy_at(0,0),xStep,yStep));</span>
<span class="lineNum">     280 </span>                : }
<span class="lineNum">     281 </span>                : 
<span class="lineNum">     282 </span>                : /// \ingroup ImageViewTransformationsSubsampled
<span class="lineNum">     283 </span>                : template &lt;typename View&gt; 
<span class="lineNum">     284 </span>                : inline typename dynamic_xy_step_type&lt;View&gt;::type subsampled_view(const View&amp; src, const typename View::point_t&amp; step) { 
<span class="lineNum">     285 </span>                :     return subsampled_view(src,step.x,step.y);
<span class="lineNum">     286 </span>                : }
<span class="lineNum">     287 </span>                : 
<span class="lineNum">     288 </span>                : /// \defgroup ImageViewTransformationsNthChannel nth_channel_view
<span class="lineNum">     289 </span>                : /// \ingroup ImageViewTransformations
<span class="lineNum">     290 </span>                : /// \brief single-channel (grayscale) view of the N-th channel of a given image_view
<span class="lineNum">     291 </span>                : 
<span class="lineNum">     292 </span>                : namespace detail {
<span class="lineNum">     293 </span>                :     template &lt;typename View, bool AreChannelsTogether&gt; struct __nth_channel_view_basic;
<span class="lineNum">     294 </span>                : 
<span class="lineNum">     295 </span>                :     // nth_channel_view when the channels are not adjacent in memory. This can happen for multi-channel interleaved images 
<span class="lineNum">     296 </span>                :     // or images with a step
<span class="lineNum">     297 </span>                :     template &lt;typename View&gt;
<span class="lineNum">     298 </span>                :     struct __nth_channel_view_basic&lt;View,false&gt; {
<span class="lineNum">     299 </span>                :         typedef typename view_type&lt;typename channel_type&lt;View&gt;::type, gray_layout_t, false, true, view_is_mutable&lt;View&gt;::value&gt;::type type;
<span class="lineNum">     300 </span>                : 
<span class="lineNum">     301 </span>                :         static type make(const View&amp; src, int n) {
<span class="lineNum">     302 </span>                :             typedef typename type::xy_locator                             locator_t;
<span class="lineNum">     303 </span>                :             typedef typename type::x_iterator                            x_iterator_t;
<span class="lineNum">     304 </span>                :             typedef typename iterator_adaptor_get_base&lt;x_iterator_t&gt;::type x_iterator_base_t;
<span class="lineNum">     305 </span>                :             x_iterator_t sit(x_iterator_base_t(&amp;(src(0,0)[n])),src.pixels().pixel_size());
<span class="lineNum">     306 </span>                :             return type(src.dimensions(),locator_t(sit, src.pixels().row_size()));
<span class="lineNum">     307 </span>                :         }
<span class="lineNum">     308 </span>                :     };
<span class="lineNum">     309 </span>                : 
<span class="lineNum">     310 </span>                :     // nth_channel_view when the channels are together in memory (true for simple grayscale or planar images)
<span class="lineNum">     311 </span>                :     template &lt;typename View&gt;
<span class="lineNum">     312 </span>                :     struct __nth_channel_view_basic&lt;View,true&gt; {
<span class="lineNum">     313 </span>                :         typedef typename view_type&lt;typename channel_type&lt;View&gt;::type, gray_layout_t, false, false, view_is_mutable&lt;View&gt;::value&gt;::type type;
<span class="lineNum">     314 </span>                :         static type make(const View&amp; src, int n) {
<span class="lineNum">     315 </span>                :             typedef typename type::x_iterator x_iterator_t;
<span class="lineNum">     316 </span>                :             return interleaved_view(src.width(),src.height(),(x_iterator_t)&amp;(src(0,0)[n]), src.pixels().row_size());
<span class="lineNum">     317 </span>                :         }
<span class="lineNum">     318 </span>                :     };
<span class="lineNum">     319 </span>                : 
<span class="lineNum">     320 </span>                :     template &lt;typename View, bool IsBasic&gt; struct __nth_channel_view;
<span class="lineNum">     321 </span>                : 
<span class="lineNum">     322 </span>                :     // For basic (memory-based) views dispatch to __nth_channel_view_basic
<span class="lineNum">     323 </span>                :     template &lt;typename View&gt; struct __nth_channel_view&lt;View,true&gt; {
<span class="lineNum">     324 </span>                :     private:
<span class="lineNum">     325 </span>                :         typedef typename View::x_iterator src_x_iterator;
<span class="lineNum">     326 </span>                : 
<span class="lineNum">     327 </span>                :         // Determines whether the channels of a given pixel iterator are adjacent in memory.
<span class="lineNum">     328 </span>                :         // Planar and grayscale iterators have channels adjacent in memory, whereas multi-channel interleaved and iterators with non-fundamental step do not.
<span class="lineNum">     329 </span>                :         BOOST_STATIC_CONSTANT(bool, adjacent=
<span class="lineNum">     330 </span>                :                               !iterator_is_step&lt;src_x_iterator&gt;::value &amp;&amp;
<span class="lineNum">     331 </span>                :                               (is_planar&lt;src_x_iterator&gt;::value ||
<span class="lineNum">     332 </span>                :                               num_channels&lt;View&gt;::value==1));
<span class="lineNum">     333 </span>                :     public:
<span class="lineNum">     334 </span>                :         typedef typename __nth_channel_view_basic&lt;View,adjacent&gt;::type type;
<span class="lineNum">     335 </span>                : 
<span class="lineNum">     336 </span>                :         static type make(const View&amp; src, int n) {
<span class="lineNum">     337 </span>                :             return __nth_channel_view_basic&lt;View,adjacent&gt;::make(src,n);
<span class="lineNum">     338 </span>                :         }
<span class="lineNum">     339 </span>                :     };
<span class="lineNum">     340 </span>                : 
<span class="lineNum">     341 </span>                :     /// \brief Function object that returns a grayscale reference of the N-th channel of a given reference. Models: PixelDereferenceAdaptorConcept.
<span class="lineNum">     342 </span>                :     /// \ingroup PixelDereferenceAdaptorModel
<span class="lineNum">     343 </span>                :     ///
<span class="lineNum">     344 </span>                :     /// If the input is a pixel value or constant reference, the function object is immutable. Otherwise it is mutable (and returns non-const reference to the n-th channel)
<span class="lineNum">     345 </span>                :     template &lt;typename SrcP&gt;        // SrcP is a reference to PixelConcept (could be pixel value or const/non-const reference)
<span class="lineNum">     346 </span>                :                                     // Examples: pixel&lt;T,L&gt;, pixel&lt;T,L&gt;&amp;, const pixel&lt;T,L&gt;&amp;, planar_pixel_reference&lt;T&amp;,L&gt;, planar_pixel_reference&lt;const T&amp;,L&gt;
<span class="lineNum">     347 </span>                :     struct nth_channel_deref_fn {
<span class="lineNum">     348 </span>                :         BOOST_STATIC_CONSTANT(bool, is_mutable=pixel_is_reference&lt;SrcP&gt;::value &amp;&amp; pixel_reference_is_mutable&lt;SrcP&gt;::value);
<span class="lineNum">     349 </span>                :     private:
<span class="lineNum">     350 </span>                :         typedef typename remove_reference&lt;SrcP&gt;::type src_pixel_t;
<span class="lineNum">     351 </span>                :         typedef typename channel_type&lt;src_pixel_t&gt;::type channel_t;
<span class="lineNum">     352 </span>                :         typedef typename src_pixel_t::const_reference const_ref_t;
<span class="lineNum">     353 </span>                :         typedef typename pixel_reference_type&lt;channel_t,gray_layout_t,false,is_mutable&gt;::type ref_t;
<span class="lineNum">     354 </span>                :     public:
<span class="lineNum">     355 </span>                :         typedef nth_channel_deref_fn&lt;const_ref_t&gt;                                        const_t;
<span class="lineNum">     356 </span>                :         typedef typename pixel_value_type&lt;channel_t,gray_layout_t&gt;::type                 value_type;
<span class="lineNum">     357 </span>                :         typedef typename pixel_reference_type&lt;channel_t,gray_layout_t,false,false&gt;::type const_reference;
<span class="lineNum">     358 </span>                :         typedef SrcP                                                                     argument_type;
<span class="lineNum">     359 </span>                :         typedef typename mpl::if_c&lt;is_mutable, ref_t, value_type&gt;::type                  reference;
<span class="lineNum">     360 </span>                :         typedef reference                                                                result_type;
<span class="lineNum">     361 </span>                : 
<span class="lineNum">     362 </span>                :         nth_channel_deref_fn(int n=0) : _n(n) {}
<span class="lineNum">     363 </span>                :         template &lt;typename P&gt; nth_channel_deref_fn(const nth_channel_deref_fn&lt;P&gt;&amp; d) : _n(d._n) {}
<span class="lineNum">     364 </span>                : 
<span class="lineNum">     365 </span>                :         int _n;        // the channel to use
<span class="lineNum">     366 </span>                : 
<span class="lineNum">     367 </span>                :         result_type operator()(argument_type srcP) const { 
<span class="lineNum">     368 </span>                :             return result_type(srcP[_n]); 
<span class="lineNum">     369 </span>                :         }
<span class="lineNum">     370 </span>                :     };
<span class="lineNum">     371 </span>                : 
<span class="lineNum">     372 </span>                :     template &lt;typename View&gt; struct __nth_channel_view&lt;View,false&gt; {
<span class="lineNum">     373 </span>                :     private:
<span class="lineNum">     374 </span>                :         typedef nth_channel_deref_fn&lt;typename View::reference&gt; deref_t;
<span class="lineNum">     375 </span>                :         typedef typename View::template add_deref&lt;deref_t&gt;   AD;
<span class="lineNum">     376 </span>                :     public:
<span class="lineNum">     377 </span>                :         typedef typename AD::type type;
<span class="lineNum">     378 </span>                :         static type make(const View&amp; src, int n) {
<span class="lineNum">     379 </span>                :             return AD::make(src, deref_t(n));
<span class="lineNum">     380 </span>                :         }
<span class="lineNum">     381 </span>                :     };
<span class="lineNum">     382 </span>                : } // namespace detail
<span class="lineNum">     383 </span>                : 
<span class="lineNum">     384 </span>                : /// \brief Given a source image view type View, returns the type of an image view over a single channel of View
<span class="lineNum">     385 </span>                : /// \ingroup ImageViewTransformationsNthChannel
<span class="lineNum">     386 </span>                : ///
<span class="lineNum">     387 </span>                : /// If the channels in the source view are adjacent in memory (such as planar non-step view or single-channel view) then the
<span class="lineNum">     388 </span>                : /// return view is a single-channel non-step view.
<span class="lineNum">     389 </span>                : /// If the channels are non-adjacent (interleaved and/or step view) then the return view is a single-channel step view.
<span class="lineNum">     390 </span>                : template &lt;typename View&gt;
<span class="lineNum">     391 </span>                : struct nth_channel_view_type {
<span class="lineNum">     392 </span>                : private:
<span class="lineNum">     393 </span>                :     GIL_CLASS_REQUIRE(View, boost::gil, ImageViewConcept)
<span class="lineNum">     394 </span>                :     typedef detail::__nth_channel_view&lt;View,view_is_basic&lt;View&gt;::value&gt; VB;
<span class="lineNum">     395 </span>                : public:
<span class="lineNum">     396 </span>                :     typedef typename VB::type type;
<span class="lineNum">     397 </span>                :     static type make(const View&amp; src, int n) { return VB::make(src,n); }
<span class="lineNum">     398 </span>                : };
<span class="lineNum">     399 </span>                : 
<span class="lineNum">     400 </span>                : 
<span class="lineNum">     401 </span>                : /// \ingroup ImageViewTransformationsNthChannel
<span class="lineNum">     402 </span>                : template &lt;typename View&gt;
<span class="lineNum">     403 </span>                : typename nth_channel_view_type&lt;View&gt;::type nth_channel_view(const View&amp; src, int n) {
<span class="lineNum">     404 </span>                :     return nth_channel_view_type&lt;View&gt;::make(src,n);
<span class="lineNum">     405 </span>                : }
<span class="lineNum">     406 </span>                : 
<span class="lineNum">     407 </span>                : 
<span class="lineNum">     408 </span>                : 
<span class="lineNum">     409 </span>                : 
<span class="lineNum">     410 </span>                : 
<span class="lineNum">     411 </span>                : 
<span class="lineNum">     412 </span>                : 
<span class="lineNum">     413 </span>                : /// \defgroup ImageViewTransformationsKthChannel kth_channel_view
<span class="lineNum">     414 </span>                : /// \ingroup ImageViewTransformations
<span class="lineNum">     415 </span>                : /// \brief single-channel (grayscale) view of the K-th channel of a given image_view. The channel index is a template parameter
<span class="lineNum">     416 </span>                : 
<span class="lineNum">     417 </span>                : namespace detail {
<span class="lineNum">     418 </span>                :     template &lt;int K, typename View, bool AreChannelsTogether&gt; struct __kth_channel_view_basic;
<span class="lineNum">     419 </span>                : 
<span class="lineNum">     420 </span>                :     // kth_channel_view when the channels are not adjacent in memory. This can happen for multi-channel interleaved images 
<span class="lineNum">     421 </span>                :     // or images with a step
<span class="lineNum">     422 </span>                :     template &lt;int K, typename View&gt;
<span class="lineNum">     423 </span>                :     struct __kth_channel_view_basic&lt;K,View,false&gt; {
<span class="lineNum">     424 </span>                :     private:
<span class="lineNum">     425 </span>                :         typedef typename kth_element_type&lt;typename View::value_type,K&gt;::type channel_t;
<span class="lineNum">     426 </span>                :     public:
<span class="lineNum">     427 </span>                :         typedef typename view_type&lt;channel_t, gray_layout_t, false, true, view_is_mutable&lt;View&gt;::value&gt;::type type;
<span class="lineNum">     428 </span>                : 
<span class="lineNum">     429 </span>                :         static type make(const View&amp; src) {
<span class="lineNum">     430 </span>                :             typedef typename type::xy_locator                             locator_t;
<span class="lineNum">     431 </span>                :             typedef typename type::x_iterator                            x_iterator_t;
<span class="lineNum">     432 </span>                :             typedef typename iterator_adaptor_get_base&lt;x_iterator_t&gt;::type x_iterator_base_t;
<span class="lineNum">     433 </span>                :             x_iterator_t sit(x_iterator_base_t(&amp;at_c&lt;K&gt;(src(0,0))),src.pixels().pixel_size());
<span class="lineNum">     434 </span>                :             return type(src.dimensions(),locator_t(sit, src.pixels().row_size()));
<span class="lineNum">     435 </span>                :         }
<span class="lineNum">     436 </span>                :     };
<span class="lineNum">     437 </span>                : 
<span class="lineNum">     438 </span>                :     // kth_channel_view when the channels are together in memory (true for simple grayscale or planar images)
<span class="lineNum">     439 </span>                :     template &lt;int K, typename View&gt;
<span class="lineNum">     440 </span>                :     struct __kth_channel_view_basic&lt;K,View,true&gt; {
<span class="lineNum">     441 </span>                :     private:
<span class="lineNum">     442 </span>                :         typedef typename kth_element_type&lt;typename View::value_type, K&gt;::type channel_t;
<span class="lineNum">     443 </span>                :     public:
<span class="lineNum">     444 </span>                :         typedef typename view_type&lt;channel_t, gray_layout_t, false, false, view_is_mutable&lt;View&gt;::value&gt;::type type;
<span class="lineNum">     445 </span>                :         static type make(const View&amp; src) {
<span class="lineNum">     446 </span>                :             typedef typename type::x_iterator x_iterator_t;
<span class="lineNum">     447 </span>                :             return interleaved_view(src.width(),src.height(),(x_iterator_t)&amp;at_c&lt;K&gt;(src(0,0)), src.pixels().row_size());
<span class="lineNum">     448 </span>                :         }
<span class="lineNum">     449 </span>                :     };
<span class="lineNum">     450 </span>                : 
<span class="lineNum">     451 </span>                :     template &lt;int K, typename View, bool IsBasic&gt; struct __kth_channel_view;
<span class="lineNum">     452 </span>                : 
<span class="lineNum">     453 </span>                :     // For basic (memory-based) views dispatch to __kth_channel_view_basic
<span class="lineNum">     454 </span>                :     template &lt;int K, typename View&gt; struct __kth_channel_view&lt;K,View,true&gt; {
<span class="lineNum">     455 </span>                :     private:
<span class="lineNum">     456 </span>                :         typedef typename View::x_iterator src_x_iterator;
<span class="lineNum">     457 </span>                : 
<span class="lineNum">     458 </span>                :         // Determines whether the channels of a given pixel iterator are adjacent in memory.
<span class="lineNum">     459 </span>                :         // Planar and grayscale iterators have channels adjacent in memory, whereas multi-channel interleaved and iterators with non-fundamental step do not.
<span class="lineNum">     460 </span>                :         BOOST_STATIC_CONSTANT(bool, adjacent=
<span class="lineNum">     461 </span>                :                               !iterator_is_step&lt;src_x_iterator&gt;::value &amp;&amp;
<span class="lineNum">     462 </span>                :                               (is_planar&lt;src_x_iterator&gt;::value ||
<span class="lineNum">     463 </span>                :                               num_channels&lt;View&gt;::value==1));
<span class="lineNum">     464 </span>                :     public:
<span class="lineNum">     465 </span>                :         typedef typename __kth_channel_view_basic&lt;K,View,adjacent&gt;::type type;
<span class="lineNum">     466 </span>                : 
<span class="lineNum">     467 </span>                :         static type make(const View&amp; src) {
<span class="lineNum">     468 </span>                :             return __kth_channel_view_basic&lt;K,View,adjacent&gt;::make(src);
<span class="lineNum">     469 </span>                :         }
<span class="lineNum">     470 </span>                :     };
<span class="lineNum">     471 </span>                : 
<span class="lineNum">     472 </span>                :     /// \brief Function object that returns a grayscale reference of the K-th channel (specified as a template parameter) of a given reference. Models: PixelDereferenceAdaptorConcept.
<span class="lineNum">     473 </span>                :     /// \ingroup PixelDereferenceAdaptorModel
<span class="lineNum">     474 </span>                :     ///
<span class="lineNum">     475 </span>                :     /// If the input is a pixel value or constant reference, the function object is immutable. Otherwise it is mutable (and returns non-const reference to the k-th channel)
<span class="lineNum">     476 </span>                :     template &lt;int K, typename SrcP&gt;        // SrcP is a reference to PixelConcept (could be pixel value or const/non-const reference)
<span class="lineNum">     477 </span>                :                                     // Examples: pixel&lt;T,L&gt;, pixel&lt;T,L&gt;&amp;, const pixel&lt;T,L&gt;&amp;, planar_pixel_reference&lt;T&amp;,L&gt;, planar_pixel_reference&lt;const T&amp;,L&gt;
<span class="lineNum">     478 </span>                :     struct kth_channel_deref_fn {
<span class="lineNum">     479 </span>                :         BOOST_STATIC_CONSTANT(bool, is_mutable=pixel_is_reference&lt;SrcP&gt;::value &amp;&amp; pixel_reference_is_mutable&lt;SrcP&gt;::value);
<span class="lineNum">     480 </span>                :     private:
<span class="lineNum">     481 </span>                :         typedef typename remove_reference&lt;SrcP&gt;::type src_pixel_t;
<span class="lineNum">     482 </span>                :         typedef typename kth_element_type&lt;src_pixel_t, K&gt;::type channel_t;
<span class="lineNum">     483 </span>                :         typedef typename src_pixel_t::const_reference const_ref_t;
<span class="lineNum">     484 </span>                :         typedef typename pixel_reference_type&lt;channel_t,gray_layout_t,false,is_mutable&gt;::type ref_t;
<span class="lineNum">     485 </span>                :     public:
<span class="lineNum">     486 </span>                :         typedef kth_channel_deref_fn&lt;K,const_ref_t&gt;                               const_t;
<span class="lineNum">     487 </span>                :         typedef typename pixel_value_type&lt;channel_t,gray_layout_t&gt;::type          value_type;
<span class="lineNum">     488 </span>                :         typedef typename pixel_reference_type&lt;channel_t,gray_layout_t,false,false&gt;::type const_reference;
<span class="lineNum">     489 </span>                :         typedef SrcP                                                              argument_type;
<span class="lineNum">     490 </span>                :         typedef typename mpl::if_c&lt;is_mutable, ref_t, value_type&gt;::type           reference;
<span class="lineNum">     491 </span>                :         typedef reference                                                         result_type;
<span class="lineNum">     492 </span>                : 
<span class="lineNum">     493 </span>                :         kth_channel_deref_fn() {}
<span class="lineNum">     494 </span>                :         template &lt;typename P&gt; kth_channel_deref_fn(const kth_channel_deref_fn&lt;K,P&gt;&amp;) {}
<span class="lineNum">     495 </span>                : 
<span class="lineNum">     496 </span>                :         result_type operator()(argument_type srcP) const { 
<span class="lineNum">     497 </span>                :             return result_type(at_c&lt;K&gt;(srcP)); 
<span class="lineNum">     498 </span>                :         }
<span class="lineNum">     499 </span>                :     };
<span class="lineNum">     500 </span>                : 
<span class="lineNum">     501 </span>                :     template &lt;int K, typename View&gt; struct __kth_channel_view&lt;K,View,false&gt; {
<span class="lineNum">     502 </span>                :     private:
<span class="lineNum">     503 </span>                :         typedef kth_channel_deref_fn&lt;K,typename View::reference&gt; deref_t;
<span class="lineNum">     504 </span>                :         typedef typename View::template add_deref&lt;deref_t&gt;   AD;
<span class="lineNum">     505 </span>                :     public:
<span class="lineNum">     506 </span>                :         typedef typename AD::type type;
<span class="lineNum">     507 </span>                :         static type make(const View&amp; src) {
<span class="lineNum">     508 </span>                :             return AD::make(src, deref_t());
<span class="lineNum">     509 </span>                :         }
<span class="lineNum">     510 </span>                :     };
<span class="lineNum">     511 </span>                : } // namespace detail
<span class="lineNum">     512 </span>                : 
<span class="lineNum">     513 </span>                : /// \brief Given a source image view type View, returns the type of an image view over a given channel of View.
<span class="lineNum">     514 </span>                : /// \ingroup ImageViewTransformationsKthChannel
<span class="lineNum">     515 </span>                : ///
<span class="lineNum">     516 </span>                : /// If the channels in the source view are adjacent in memory (such as planar non-step view or single-channel view) then the
<span class="lineNum">     517 </span>                : /// return view is a single-channel non-step view.
<span class="lineNum">     518 </span>                : /// If the channels are non-adjacent (interleaved and/or step view) then the return view is a single-channel step view.
<span class="lineNum">     519 </span>                : template &lt;int K, typename View&gt;
<span class="lineNum">     520 </span>                : struct kth_channel_view_type {
<span class="lineNum">     521 </span>                : private:
<span class="lineNum">     522 </span>                :     GIL_CLASS_REQUIRE(View, boost::gil, ImageViewConcept)
<span class="lineNum">     523 </span>                :     typedef detail::__kth_channel_view&lt;K,View,view_is_basic&lt;View&gt;::value&gt; VB;
<span class="lineNum">     524 </span>                : public:
<span class="lineNum">     525 </span>                :     typedef typename VB::type type;
<span class="lineNum">     526 </span>                :     static type make(const View&amp; src) { return VB::make(src); }
<span class="lineNum">     527 </span>                : };
<span class="lineNum">     528 </span>                : 
<span class="lineNum">     529 </span>                : /// \ingroup ImageViewTransformationsKthChannel
<span class="lineNum">     530 </span>                : template &lt;int K, typename View&gt;
<span class="lineNum">     531 </span>                : typename kth_channel_view_type&lt;K,View&gt;::type kth_channel_view(const View&amp; src) {
<span class="lineNum">     532 </span>                :     return kth_channel_view_type&lt;K,View&gt;::make(src);
<span class="lineNum">     533 </span>                : }
<span class="lineNum">     534 </span>                : 
<span class="lineNum">     535 </span>                : } }  // namespace boost::gil
<span class="lineNum">     536 </span>                : 
<span class="lineNum">     537 </span>                : #endif
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
  <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LTP GCOV extension version 1.6</a></td></tr>
  </table>
  <br>

</body>
</html>
